<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" xmlns:head="http://www.w3.org/1999/html">
<head th:include="public/public_css::public_css ('快速出库查看详情')" />

<body style="background-color: #f2f2f2;">
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
            <section class="panel panel-padding layui-card-body">
                <div class="pro">
                    <table id="table" class="table text-nowrap"></table>
                </div>
            </section>
            <input type="hidden" th:value="${id}" id="lowerId">
        </div>
    </div>
</div>

</body>
<div th:include="public/public_js::public_js"></div>
<div th:include="public/public_btn::public_btn"></div>
<style type="text/css">
    .moreBtn{
        width:50px;
        height:20px;
        text-align:center;
        color:#fff;
        line-height:20px;
        background-color:#eee;
        position:relative;
        margin: 0 auto;
        cursor: pointer;
    }
    .moreBtn:before{
        content:'';
        display:block;
        width:35px;
        height:20px;
        position:absolute;
        transform:skewX(30deg);
        background:#eee;
        border-top-left-radius:8px;
        left:-20px;
        top:0;
    }
    .moreBtn:after{
        content:'';
        display:block;
        width:35px;
        height:20px;
        position:absolute;
        transform:skewX(-30deg);
        background:#eee;
        border-top-right-radius:8px;
        top:0;
        right:-20px;
    }
</style>
<script>

    layui.use(['list', 'layer', 'zzpUtils', 'jquery', 'laydate', 'tablebutton'], function () {
// 行内按钮
        window.operateEvent ={
            "click #delect":function (e, value, row, index) {
                console.log('触发了删除', row);
                var ids=new Array();
                ids.push(row.id);
                var data = {
                    ids: ids
                }
                $.ajax({
                    url: '/zxsswms/wmsquickexitdetailed/del',
                    type: 'POST',
                    dataType: 'json',
                    contentType: 'application/json',
                    data: JSON.stringify(data),
                    success: function (data) {
                        if (data.type === 'success') {
                            layer.msg(data.title)
                            $table.bootstrapTable('remove', {field: 'id', values: ids});
                        }else{
                            layer.msg(data.title+","+data.message)

                        }
                    },
                    error: function () { console.log("Error"); }
                })
            },
        }

        var zzpUtils= layui.zzpUtils,
            $ = layui.jquery,
            laydate = layui.laydate

        //加载表格
        var $table = zzpUtils.table({
            elem: '#table',
            isApi: true,
            pagination:false,
            showColumns: false,
            columns: [{
                field: 'hpbh',
                title: '货品编号'
            },{
                field: 'hpmc',
                title: '货品名称'
            },{
                field: 'kwmc',
                title: '库位名称'
            },{
                field: 'hppc',
                title: '货品批次',
            },{
                field: 'scrq',
                title: '生产日期'
            },{
                field: 'gg',
                title: '规格'
            },{
                field: 'nc',
                title: 'NC编码'
            },{
                field: 'sl',
                title: '主单位数量'
            },{
                field: 'zdwmc',
                title: '主单位名称'
            },{
                field:'caozuo',
                title: '操作',
                events: operateEvent,
                formatter: operateFormatter
            }]

        });
        $(function () {
            console.log(666666);
            $.ajax({
                url: "/zxsswms/wmsquickexitdetailed/list/"+$("#lowerId").val(),
                type: "POST",
                dataType: "JSON",
                contentType: 'application/json',
                async: false,
                success: function (data) {
                    console.log(666666, data);
                    $table.bootstrapTable('append', data.rows);
                },
                error: function () { console.log("Error"); }
            });
        })
        /*表格右侧按钮*/
        function operateFormatter(value, row, index) {
            return [
                '<a class="layui-btn layui-btn-xs" id="delect">删除</a>'
            ].join('')
        }
    });
</script>
</html>